<?php
    session_start();
    include("includes/checklogged.php");
    include("includes/mysql_connect.inc.php");
    check_logged();
?>

<?php include('includes/header.php'); ?>
<?php 
  if ($_SESSION["logged"] == "admin"){
    include('includes/nav.php'); 
  }
  else{ 
	include('includes/nav2.php');
}?> 

<div id="content">
<?php 
//====================================================================================================================
include_once("includes/mysql_connect.inc.php");

global $link;
   
   $sql  = "select userid, User_Name, Password, Last_Name from userlist";
      print '</br>';
      print '<u><font color="black" size=3> USER LIST</font><br><br></u>';
   $result=mysql_query($sql,$link);

   if (!$result)
   {
      die("Mysql List user to DB error...".$sql);
   }

   $formshow  = '<TABLE BORDER="2" align=center><TR>';
   $formshow .= '<TD width="70" align=center><b><font color="#47456d">User ID</font></TD>';
   $formshow .= '<TD width="200" align=center><b><font color="#47456d">User Name</font></TD>';
   $formshow .= '<TD width="200" align=center><b><font color="#47456d">Last Name</font></TD></TR></b>';

   while($data=mysql_fetch_array($result,MYSQL_ASSOC))
   {
      $formshow .= '<TR><TD><font face="arial" color="#47456d" size=2>'.$data["userid"].'<font></TD>';
      $formshow .= '<TD><font face="arial" color="#47456d" size=2>'.$data["User_Name"].'<font></TD>';
      $formshow .= '<TD><font face="arial" color="#47456d" size=2>'.$data["Last_Name"].'<font></TD></TR>';
   }

   $formshow .= '</TABLE>';
   $formshow .= '<BR><BR><FONT color="red">Total No. of Users Listed: '.mysql_num_rows($result).'</font></br>';
   $formshow .= '<table><tr>
	<td align="right" width=650><font size="2" face="MS Sans Serif"><img src="images/printlogo.png" height="20" width="20"><a style="color:#909090" href="javascript:window.print()">print this page</font></a></></td>
	</tr></table>';

   print $formshow;
//====================================================================================================================
?>
</div> <!-- end #content -->

<?php 
  if ($_SESSION["logged"] == "admin"){
    include('includes/sidebar.php'); 
  }
  else{ 
	include('includes/sidebar3.php');
  }?> 
<?php include('includes/footer.php'); ?>
